Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webview to start pipeline #323

Closed
wants to merge 24 commits into from
Closed

Conversation

sudhirverma
Copy link
Contributor

@sudhirverma sudhirverma commented Jun 7, 2020

Fix: #310

Starting Pipeline with git resource and image resource

Screen Recording 2020-06-23 at 11 41 52 AM (2)

Starting Pipeline with workspace

Screen Recording 2020-06-23 at 1 36 20 PM

@sudhirverma sudhirverma marked this pull request as draft June 7, 2020 15:40
@codecov-commenter
Copy link

codecov-commenter commented Jun 7, 2020

Codecov Report

Merging #323 into master will decrease coverage by 1.55%.
The diff coverage is 25.21%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #323      +/-   ##
==========================================
- Coverage   74.16%   72.61%   -1.56%     
==========================================
  Files          45       47       +2     
  Lines        3399     3484      +85     
  Branches      632      644      +12     
==========================================
+ Hits         2521     2530       +9     
- Misses        878      954      +76     
Impacted Files Coverage Δ
src/tkn.ts 63.14% <11.90%> (-2.28%) ⬇️
src/tekton/webviewstartpipeline.ts 18.75% <18.75%> (ø)
src/view/pipeline/pipelineViewLoader.ts 22.85% <22.85%> (ø)
src/tekton/tektonitem.ts 77.21% <30.00%> (-7.72%) ⬇️
src/tekton/pipeline.ts 65.75% <44.44%> (-2.43%) ⬇️
src/tekton/pipelinecontent.ts 93.45% <100.00%> (ø)
src/util/MultiStepInput.ts 10.16% <0.00%> (-2.95%) ⬇️
src/pipeline/preview.ts 9.82% <0.00%> (-0.80%) ⬇️
src/tools.ts 94.68% <0.00%> (-0.06%) ⬇️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6a77a31...cb31c55. Read the comment docs.

@sudhirverma
Copy link
Contributor Author

@evidolob and @siamaksade

webview for starting pipeline.

Screenshot 2020-06-14 at 11 58 14 PM

@sudhirverma
Copy link
Contributor Author

Workspace UI

Screenshot 2020-06-17 at 2 49 21 PM

@sudhirverma sudhirverma marked this pull request as ready for review June 23, 2020 01:28
@sudhirverma sudhirverma marked this pull request as draft June 23, 2020 06:00
@sudhirverma
Copy link
Contributor Author

sudhirverma commented Jun 23, 2020

starting pipeline with pipeline resource

Screen Recording 2020-06-23 at 11 41 52 AM (2)

@sudhirverma
Copy link
Contributor Author

Starting pipeline with workspace

Screen Recording 2020-06-23 at 1 36 20 PM

@sudhirverma sudhirverma changed the title webview to start pipeline [WIP] webview to start pipeline Jun 23, 2020
@sudhirverma sudhirverma marked this pull request as ready for review June 23, 2020 08:20
Copy link
Collaborator

@evidolob evidolob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some vulnerabilities in packages that you add:

                                                                                
                       === npm audit security report ===                        
                                                                                
┌──────────────────────────────────────────────────────────────────────────────┐
│                                Manual Review                                 │
│            Some vulnerabilities require your attention to resolve            │
│                                                                              │
│         Visit https://go.npm.me/audit-guide for additional guidance          │
└──────────────────────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate      │ Cross-Site Scripting                                         │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ jquery                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=3.5.0                                                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ @patternfly/react-catalog-view-extension                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ @patternfly/react-catalog-view-extension > patternfly >      │
│               │ jquery                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://npmjs.com/advisories/1518                            │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ High          │ Cross-Site Scripting                                         │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ bootstrap-select                                             │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=1.13.6                                                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ @patternfly/react-catalog-view-extension                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ @patternfly/react-catalog-view-extension > patternfly >      │
│               │ bootstrap-select                                             │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://npmjs.com/advisories/1522                            │
└───────────────┴──────────────────────────────────────────────────────────────┘

Can you fix them?

Also as I say in comment you should add comment for all copied files with link where you take them.

Also some combobox dropdown list not rendered correctly:
Screenshot 2020-06-23 at 14 29 48

"Title": "Start Pipeline",
"type": "boolean",
"default": false,
"description": "Enable/disable to Start Pipeline in webView"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enable/disable to Start Pipeline in webView Is not clear as for me,
maybe Enable WebView Wizard to Start Pipeline is better.
As for me Enable/disable is very confusing.

static async start(pipeline: TektonNode): Promise<string> {
if (Pipeline.checkWebViewStartPipeline()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe having separate command for webview wizard will be better? @siamaksade ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think enabling webview from setting would be better.

@@ -33,7 +46,7 @@ export class Pipeline extends TektonItem {
const pipelineTrigger = data.map<Trigger>(value => ({
name: value.metadata.name,
resources: value.spec.resources,
params: value.spec.params ? value.spec.params : undefined,
parameters: value.spec.params ? value.spec.params : undefined,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there you can use value.spec.params ?? undefined see nullish-coalescing But in this case is no sense to do that check.

}


export const pipelineData = async (name: string) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can define function instead of exporting constant, which you assign lambda, or you have particular reason to do that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No particular reason for using lambda. I will use function here.

* Copyright (c) Red Hat, Inc. All rights reserved.
* Licensed under the MIT License. See LICENSE file in the project root for license information.
*-----------------------------------------------------------------------------------------------*/

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that copied file, you need to add comment from which repository you copied all this files.

localResourceRoots: [localResourceRoot],
retainContextWhenHidden: true
});
panel.iconPath = vscode.Uri.file(path.join(PipelineViewLoader.extensionPath, 'images/tekton.svg'));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will not work for windows, this line should be panel.iconPath = vscode.Uri.file(path.join(PipelineViewLoader.extensionPath, 'images','tekton.svg'));

panel.webview.html = PipelineViewLoader.getWebviewContent(PipelineViewLoader.extensionPath, context);
panel.webview.onDidReceiveMessage(async (event) => {
if (event.action === 'cancel') {
await commands.executeCommand('workbench.action.closeActiveEditor');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use panel.webview.dispose() instead of calling 'commands.executeCommand('workbench.action.closeActiveEditor');' command

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dispose function does not exist on type Webview

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it exists on WebviewPanel

await commands.executeCommand('workbench.action.closeActiveEditor');
}
if (event.action === 'start') {
await commands.executeCommand('workbench.action.closeActiveEditor');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same there

path.join(reactAppRootOnDisk, 'pipelineView.js'),
);
const reactAppUri = reactAppPathOnDisk.with({ scheme: 'vscode-resource' });
const htmlString: Buffer = fs.readFileSync(path.join(reactAppRootOnDisk, 'index.html'));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should mostly never use synchronous node API, please use readFile instead of readFileSync

@siamaksade
Copy link

We should pivot to a more wizard-like experience instead of the modal-based approach that we have in dev console:

Screenshot 2020-06-23 at 18 02 40

Also the the look and feel of it should match much closer to the vs code UI elements. This wizard would we quite similar to the Settings UI:
Screenshot 2020-06-23 at 18 05 55

@evidolob
Copy link
Collaborator

@siamaksade For start @sudhirverma just copy code from dev-console, so basically we embed part of the dev-console UI.
We start discussion with dev-console team, about code sharing. They have a plan to extract some parts of dev-console from OS dashboard repository. But it seems it take time, and will be not so fast.

You propose to implement own version of wizard, base on UI mockup for dev-console?

To be honest I'm not very happy with that copied code, especially with it dependencies, compiled single JS file for that wizard is 24Mb, where all archive for vscode-tekton-0.2.0.vsix is 9Mb.

So I'm definitely +1 to implement own, but we need to figure out how we can share that new implementation with dev-console team. And we need to be carefully about dependencies what we use in it.

"webpack-cli": "^3.3.11"
},
"dependencies": {
"@kubernetes/client-node": "^0.10.2",
"@patternfly/patternfly": "2.71.5",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All dependencies that we use in any webview should be moved to devDependencies as we compiled them it webpack bundle, and we do not need to distribute them inside vsix package

@siamaksade
Copy link

@evidolob I don't think we should sacrifice the UX for the sake of sharing code with dev console. If sharing code with dev console saves time, sure. If adds overhead, not sure what the value is.

@sudhirverma
Copy link
Contributor Author

Closing this PR as we are implementing a new wizard according to vscode.

@sudhirverma sudhirverma closed this Jul 3, 2020
@sudhirverma sudhirverma deleted the 310 branch July 8, 2020 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create Webview to start pipeline.
4 participants